package com.ruoyi.shop.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.shop.api.RemotePetrolService;
import com.ruoyi.shop.api.domain.ChePetrol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName RemotePetrolFallbackFactory
 * @Description TODO
 * @Author mujiale
 * @Date 2025年01月06日 15:19
 * @Version 1.0
 */
@Component
public class RemotePetrolFallbackFactory implements FallbackFactory<RemotePetrolService> {
    private static final Logger log = LoggerFactory.getLogger(RemotePetrolFallbackFactory.class);

    @Override
    public RemotePetrolService create(Throwable throwable) {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemotePetrolService() {
            @Override
            public ChePetrol getInfo1(Long id, String source) {
                return new ChePetrol();
            }
        };
    }
}
